package org.reliablesource.client.ui.workbench.views;

public class ReliableWorkbenchException extends Exception{

    /**
     * 
     */
    private static final long serialVersionUID = 1350638543921230960L;

    /**
     * id the error id
     */
    protected String id;

    /**
     * The blank string
     */
    private final String BLANK = "";


    /**
     * source the plugin where the error occured
     */
    protected String source = BLANK;

    /**
     * @param id
     * @param pluginId
     * @param message
     */
    public ReliableWorkbenchException(String id, String pluginId, String message)
    {
        super(message);
        this.id = id;
        this.source = pluginId;
    }

    /**
     * @param id
     * @param pluginId
     * @param message
     * @param cause
     */
    public ReliableWorkbenchException(String id, String pluginId, String message,
            Throwable cause)
    {
        super(message, cause);
        if (id == null || id.equals(BLANK))
            throw new IllegalArgumentException("Illegal Id");
        this.id = id;
        this.source = pluginId;
    }

    /**
     * Returns the error id of this error
     *
     * @return String the error id
     */

    public String getId()
    {
        return this.id;
    }

    /**
     * Returns the Plugin ID for this error.
     *
     * @return String the plugin where the exception occurred
     */

    public String getSource()
    {
        return source;
    }
}
